<?php
/**
 *
 *
 */
class Extra extends AppModel
{
    public $name       = "Extra";
    public $primaryKey = "ExtrasId";



    public function get_all()
    {
        return self::find('all', array('conditions' => array('active' => 1)));
    }

    public function get_extras_id($value)
    {
        return self::find('first', array('conditions' => array('value' => $value, 'active' => 1), 'fields' => array('extrasId')));
    }

    public function get_extras_value($id)
    {
        return self::find('first', array('conditions' => array('extrasId' => $id, 'active' => 1), 'fields' => array('value')));
    }

    public function get_extras_data($etype)
    {
        return self::find('first', array('conditions' => array('etype' => $etype, 'active' => 1), 'fields' => array('value')));
    }

    public function get_extras_by_data($etype)
    {
        return self::find('all', array('conditions' => array('etype' => $etype, 'active' => 1), 'fields' => array('extrasId', 'etype', 'value')));
    }

    public function get_extras_id_by_etype($etype)
    {
        return self::find('first', array('conditions' => array('etype' => $etype, 'active' => 1), 'fields' => array('extrasId')));
    }

    public function get_all_etype()
    {
       return self::find('all', array('conditions' => array('active' => 1), 'fields' => array('extrasId', 'etype'), 'group' => array('etype')));
    }

    public function get_value($string)
    {
        return self::find('all', array('conditions' => array('value LIKE' => "%{$string}%", 'active' => 1)));
    }
}
?>